function validateForm(){
    var execute = "si"
    
    var message = "";
    if(code.value == ""){
        message = "Ingrese el codigo" ;        
    }else if(description.value == ""){
        message = "Ingrese el Nombre";
    }else if(available.value != "0"){
        message = "El codigo ingresado no esta disponible";
    }else{ 
        document.getElementById("form").submit(); 
        return false ;
    }
    
    document.getElementById("bodyMessage").innerHTML = message; 
}

function confirmDelete(record){
    
    $('#id').val(record);  
}

function submitDelete(){
 
    document.getElementById("form").action = 'delete?id='+$('#id').val()+"&module="+$('#module').val();
    document.getElementById("form").submit();  
}

  function existCode(){ 
      var execute = "si"
      
      contenedor = document.getElementById("codeoriginal")  ;
      
    if(contenedor != null){
        
        if(codeoriginal.value == code.value){ 
            execute = "no";
            $('#showDetail').html('<input type="hidden" value="0" name="available" id="available" />');
        }
    }
    if(execute == "si"){
    
        var requestUrl = '/GedeonMvc/billingunit/searchByCode'   ;
     
              $.ajax({
        type: "POST",
        url: requestUrl,
        data: "code="+code.value ,
        success: function(response){ 
        $('#showDetail').html(response);
        },
        error: function(e){
        alert('Error: ' + e);
        }
        });
}

  
 
    }



